function validate()
{

                var name=0;
                var email=0;
				var rollNumber=0;
				var college=0;
                var pass=0;
				var confirmPass=0;
                var gender=0;
				var referrer=0;
				var location=0;
				var domain=0;
                var must=1;
                var error=0;
                $('.error').html("");

				$.ajax({url:"ajax/registration_validation.php",
					type:"POST",
					async: false,
					data: {email: $('#email').val(), rollNumber: $('#rollNumber').val()},
					success:function(data){
						var splited_data = data.split("_");
								//ic, im, ie, ee, re
								for(var i=0; i<splited_data.length; ++i )
								{
									  //ie = invalid email, when email id is invalid
									  if(splited_data[i]=='ie')
									  {
												email=1;
												error=1;
												//$('#email').val("");
												$('#emailError').html(" Please enter a valid email address");
									  }
									  if(splited_data[i]=='ee')
									  {
												email=1;
												error=1;
												//$('#email').val("");
												$('#emailError').html(" Email you entered is already registered");
									  }	
									/*
									  if(splited_data[i]=='re')
									  {
												rollNumber=1;
												error=1;
												//$('#rollNumber').val("");
												$('#rollNumberError').html(" Roll number you entered is already registered");
									  }	
									 */
								}
								// Referral checking 								
								if($('#referrer').val()=="--") 
								{
									referrer=1;
									error=1;
									//$('#email').val("");
									$('#referrerError').html(" Please select referrer");
								}
								// Domain checking 								
								if($('#domain').val()=="--") 
								{
									domain=1;
									error=1;
									//$('#email').val("");
									$('#domainError').html(" Please select domain");
								}
								// Location checking 								
								if($('#location').val()=="--") 
								{
									location=1;
									error=1;
									//$('#email').val("");
									$('#locationError').html(" Please select location");
								}
								// Referral checking 								
								if($('#referrer').val()=="Employee Referral" && $('#employeeName').val().trim()=="") 
								{
									employeeName=1;
									error=1;
									//$('#email').val("");
									$('#employeeNameError').html(" Please enter employee name");
								}
								// Referral Id checking    		
								if($('#employeeId').val().trim()!="" && !$('#employeeId').val().match(/^\d+/)) 
								{
									employeeId=1;
									error=1;
									//$('#employeeId').val("");
									$('#employeeIdError').html(" Employee id should be numeric");
								}
								// Email checking    		
								if($('#email').val().trim()=="" || $('#email').val().trim()=="Personal email address") 
								{
									college=1;
									error=1;
									//$('#email').val("");
									$('#emailError').html(" Please enter your email");
								}
								// Company checking    		
								if($('#company').val().trim()=="" || $('#company').val().trim()=="Current/Previous company name" ) 
								{
									company=1;
									error=1;
									//$('#email').val("");
									$('#companyError').html(" Please enter your company name.( Enter 'None' if you don't have any experience)");
								}
								// Mobile Number checking 10 digit or not  		
								if($('#mobileNo').val().length != 10 ) 
								{
									mobileNo=1;
									error=1;
									//$('#mobileNo').val("");
									$('#mobileNoError').html(" Should be 10 digit");
								}
								// Mobile Number checking numeric or not    	
								if(!$('#mobileNo').val().match(/^\d+/)) 
								{
									mobileNo=1;
									error=1;
									$('#mobileNoError').html(" Mobile number should be numeric");
								}	
								// Mobile Number checking bank or not  		
								if($('#mobileNo').val().trim()=="" || $('#mobileNo').val().trim()=="10-digit mobile number" ) 
								{
									mobileNo=1;
									error=1;
									//$('#mobileNo').val("");
									$('#mobileNoError').html(" Please enter your Mobile Number");
								}
								// experience checking
								if(!$('#experience').val().match(/^\d+/)) 
								{
									experience=1;
									error=1;
									//$('#experience').val("");
									$('#experienceError').html(" Experience should be numeric");
								}
								// experience checking
								if($('#experience').val().trim()=="" || $('#experience').val().trim()=="e.g.: 1 or 2.5" ) 
								{
									experience=1;
									error=1;
									//$('#experience').val("");
									$('#experienceError').html(" Please enter your Experience (Enter 0 if you don't have experience)");
								}
								// College checking
								/*								
								if($('#college').val().trim()=="" ) 
								{
									college=1;
									error=1;
									$('#college').val("");
									$('#collegeError').html(" Please enter your college/university");
								}
								// Roll number checking                
								if($('#rollNumber').val().trim()=="" ) 
								{
									rollNumber=1;
									error=1;
									$('#rollNumber').val("");
									$('#rollNumberError').html(" Please enter your roll number");
								}
								*/
								// password checking                
								if($('#password').val().length<3 ) 
								{
									pass=1;
									error=1;
									$('#password').val("");
									$('#passwordError').html(" Please enter a password with minimum of 3 characters");
								}
								 // password checking                
								if($('#password').val()!=$('#confirmPassword').val())
								{
									pass=1;
									error=1;
									$('#password').val("");
									$('#confirmPasswordError').html(" Password and confirm password doesn\'t match");
								}
								// name checking
								if($('#name').val().trim()=='' || $('#name').val().trim()=='Full name')
								{
									name=1;
									error=1;
									$('#nameError').html(" Please enter your name");
								}
								
								// gender checking
								if($('input[name=gender]:checked').length<=0)
								{
									gender=1;
									error=1;
									$('#genderError').html("  Please select your gender");
								}
								if(!error)
									$("#registrationForm").submit();								
					}
				});
/*
                if(error==0)
				{
                $('#registration').submit();
                } 

*/
}